<template>
  <div id="home">
    <HeaderView></HeaderView>
    <SearchView></SearchView>
    <MenuMain></MenuMain>
    <section id="recommen" class="list-title">
      <div class="list-title-content ">
        <span>Widgets</span>
        <img src="../assets/images/hamburger.png" width="20" height="20">
      </div>
    </section>
    <MenuView></MenuView>
    <RecommenView></RecommenView>
    <RecommenListView></RecommenListView>

  </div>

</template>
<script>

  import HeaderView from '../components/Header.vue';
  import SearchView from '../components/Search.vue';
  import MenuView from '../components/Menu.vue';
  import MenuMain from '../components/MenuMain.vue';
  import RecommenView from '../components/Recommen.vue';
  import RecommenListView from '../components/RecommenList.vue';
  export default{
    mounted(){
        this.toHome();
    },
    methods: {

      toHome(){
        var post = this;
        this.$http.jsonp(global.URL + "/toHome", //跨域请求接口
          {
            params: {}
          }).then(function (response) {
          this.users = response.data;

          if (response.data == "0") {
            swal("OMG", "Please login!", "error");
            post.$router.replace({path: '/login'})
          } else {

          }
        }, function (error) {
          swal("OMG", "Please login!", "error");
          post.$router.replace({path: '/login'})
        });
      }
    },
    components: {

      HeaderView,
      RecommenListView,
      SearchView,
      MenuView,
      MenuMain,
      RecommenView

    }
  }
</script>
<style>

  @import '../assets/css/base.css';
  @import '../assets/css/index.css';
  @import '../assets/css/lfooter.css';

</style>

